package com.fsnbigdata.service.impl;
import com.fsnbigdata.service.api.OrganismSpecimenService;
import org.springframework.roo.addon.layers.service.annotations.RooServiceImpl;
import com.fsnbigdata.domain.Organism;
import com.fsnbigdata.domain.OrganismSpecimen;
import com.fsnbigdata.repository.OrganismSpecimenRepository;
import io.springlets.data.domain.GlobalSearch;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * = OrganismSpecimenServiceImpl
 *
 * TODO Auto-generated class documentation
 *
 */
@RooServiceImpl(service = OrganismSpecimenService.class)
@Service
@Transactional(readOnly = true)
public class OrganismSpecimenServiceImpl implements OrganismSpecimenService {

    /**
     * TODO Auto-generated attribute documentation
     *
     */
    private OrganismSpecimenRepository organismSpecimenRepository;

    /**
     * TODO Auto-generated constructor documentation
     *
     * @param organismSpecimenRepository
     */
    @Autowired
    public OrganismSpecimenServiceImpl(OrganismSpecimenRepository organismSpecimenRepository) {
        setOrganismSpecimenRepository(organismSpecimenRepository);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return OrganismSpecimenRepository
     */
    public OrganismSpecimenRepository getOrganismSpecimenRepository() {
        return organismSpecimenRepository;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param organismSpecimenRepository
     */
    public void setOrganismSpecimenRepository(OrganismSpecimenRepository organismSpecimenRepository) {
        this.organismSpecimenRepository = organismSpecimenRepository;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param entity
     * @return OrganismSpecimen
     */
    @Transactional
    public OrganismSpecimen save(OrganismSpecimen entity) {
        return getOrganismSpecimenRepository().save(entity);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param id
     * @return OrganismSpecimen
     */
    public OrganismSpecimen findOne(Long id) {
        return getOrganismSpecimenRepository().findOne(id);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param id
     * @return OrganismSpecimen
     */
    public OrganismSpecimen findOneForUpdate(Long id) {
        return getOrganismSpecimenRepository().findOneDetached(id);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param ids
     * @return List
     */
    public List<OrganismSpecimen> findAll(Iterable<Long> ids) {
        return getOrganismSpecimenRepository().findAll(ids);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param organism
     * @param globalSearch
     * @param pageable
     * @return Page
     */
    public Page<OrganismSpecimen> findByOrganism(Organism organism, GlobalSearch globalSearch, Pageable pageable) {
        return getOrganismSpecimenRepository().findByOrganism(organism, globalSearch, pageable);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param organism
     * @return Long
     */
    public long countByOrganism(Organism organism) {
        return getOrganismSpecimenRepository().countByOrganism(organism);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return Class
     */
    public Class<OrganismSpecimen> getEntityType() {
        return OrganismSpecimen.class;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return Class
     */
    public Class<Long> getIdType() {
        return Long.class;
    }
}
